Skip to content

Support Payload api route config#77

Open
mzronek wants to merge 3 commits into
janbuchar:masterfrom
mzronek:dynamic-api-basepath
Open

Support Payload api route config#77
mzronek wants to merge 3 commits into
janbuchar:masterfrom
mzronek:dynamic-api-basepath

Conversation

@mzronek
Copy link
Copy Markdown

@mzronek mzronek commented May 14, 2026

The current implementation always uses /api as base path for all Payload routes. This will produce an invalid spec if the Payload config uses routes.api to customize the api route path. This PR fixes the issue and adds the possibility to customize it completely.

@janbuchar
Copy link
Copy Markdown
Owner

Hi @mzronek and thanks for your contribution! How does this compare to #76?

mzronek added 2 commits May 14, 2026 21:59
… hardcoding /api, add another test to check if the payload api route config works
@mzronek
Copy link
Copy Markdown
Author

mzronek commented May 14, 2026

@janbuchar Glad to support the project!

Unfortunately I missed this PR. It is very close to mine. The only difference is, that my approach allows the apiBasePath to bet set freely in the plugin options. Otherwise it defaults to the currently configured Payload api route. Sorry for any inconvenience.

I updated my PR, because I liked the idea of the previous PR to use the sanitized payload config from the req object to avoid hardcoding "/api". I also added a second test to properly test changes to the Payload config.
In addition I added the correct Zed config to be able to work correctly with Biome. Without the correct Zed setup even running yarn lint:fix can't undo small style changes for long lines due to introduced commas.

Comment thread .zed/settings.json
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to include editor specific config files in the repo, I don't use Zed personally and there's not config for VSCode, either 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants